#ifndef MEMORY_ALLOC_H
#define MEMORY_ALLOC_H
#include <Windows.h>

class MemoryAlloc
{
public:
	MemoryAlloc(HANDLE process, DWORD size, void* base = 0, DWORD protection = PAGE_EXECUTE_READWRITE);
	MemoryAlloc(const MemoryAlloc& rhs) = delete;
	MemoryAlloc(MemoryAlloc&& rhs);
	~MemoryAlloc(void);

	MemoryAlloc& operator=(const MemoryAlloc& rhs) = delete;
	MemoryAlloc& operator=(MemoryAlloc&& rhs);
	char operator[](int index);


	void Write(DWORD offset, const void* data, DWORD size) const;
	void Read(DWORD offset, void* buffer, DWORD size) const;


	void* GetAddress(void) const;
private:
	HANDLE	m_process;
	char*	m_baseAddress;
	DWORD	m_size;
};
#endif